package com.ruoyi.eqmonitor.smdtv.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.eqmonitor.smdtv.domain.Smregister;
import com.ruoyi.eqmonitor.smdtv.service.*;
import com.ruoyi.eqmonitor.smdtv.mapper.SmregisterMapper;
import com.ruoyi.eqmonitor.smdtv.vo.SmregisterVo;
import com.ruoyi.eqmonitor.smdtv.vo.SumVo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @description 针对表【smregister】的数据库操作Service实现
 * @createDate 2022-12-06 12:01:16
 */
@Service
public class SmregisterServiceImpl extends ServiceImpl<SmregisterMapper, Smregister>
        implements SmregisterService{

    @Resource
    private SmregisterMapper smregisterMapper;

    @Resource
    private ISmdtv9Service ISmdtv9Service;
    @Resource
    private ISmdtv11Service smdtv11Service;
    @Resource
    private ISmdtv8Service smdtv8Service;
    @Resource
    private ISmdtv17Service ISmdtv17Service;

    @Override
    public List<SmregisterVo> getAll() {
        return smregisterMapper.getAll();
    }

    @Override
    public List<Map<String,Object>> getSmdtv(String smtablename, String name) {
        return smregisterMapper.getSmdtv(smtablename,name);
    }

    @Override
    public List<SumVo> getSum(String name) {
        List<SumVo> sumVos = new ArrayList<>();
        sumVos.add(smdtv8Service.getSum(name));
        sumVos.add(ISmdtv9Service.getSum(name));
        sumVos.add(smdtv11Service.getSum(name));
        sumVos.add(ISmdtv17Service.getSum(name));

        return sumVos;
    }


    @Override
    public Integer selectCount(String tableName,String whereSQL) {
        return smregisterMapper.selectCount(smregisterMapper.getTableNameByDatasetName(tableName),whereSQL);
    }

}




